package org.apache.click.doubleclick.annotationconfig;

import org.apache.commons.lang.Validate;
import org.scannotation.archiveiterator.Filter;

import java.io.File;

public class CustomFilter implements Filter {
    private String basePackage;

    public CustomFilter(String basePackage) {
        Validate.notNull(basePackage, "Base package can not be null");
        this.basePackage = basePackage;
        this.basePackage = basePackage.replace('.', File.separatorChar);
    }

    @Override
    public boolean accepts(String filename) {
        if (filename.contains(basePackage) && filename.endsWith(".class")) {
            return true;
        }
        return false;
    }
}
